package com.imufe.chemicalenterprisedangerwarning.entity.query;

import com.imufe.chemicalenterprisedangerwarning.annotation.ExistId;
import com.imufe.chemicalenterprisedangerwarning.mapper.CheckItemMapper;
import com.imufe.chemicalenterprisedangerwarning.mapper.CheckUnitMapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.*;

/**
 * @author BaiBan
 * @since 2022/10/6
 */
@ApiModel("模块条目项请求")
@Data
public class UnitItemQuery {

    @ApiModelProperty("模块条目项编号")
    @Null(message = "创建时模块条目编号不能填", groups = CreateGroup.class)
    @NotNull(message = "修改时模块条目项编号必须填", groups = UpdateGroup.class)
    private Long id;

    @ApiModelProperty("分数")
    @Min(message = "分数不能小于0, 也不能大于100", value = 1, groups = CreateGroup.class)
    @Max(message = "分数不能小于0, 也不能大于100", value = 100, groups = CreateGroup.class)
    private Integer mark;

    @ApiModelProperty("检查模块编号")
    @ExistId(message = "检查模块不存在，请选择正确的检查模块", groups = CreateGroup.class, value = CheckUnitMapper.class)
    private Long unitId;

    @ApiModelProperty("检查条目编号")
    @ExistId(message = "检查条目不存在，请选择正确的检查条目", groups = CreateGroup.class, value = CheckItemMapper.class)
    private Long itemId;
}
